#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int chang = s.size();
  long long int box = 0;
  for (int i = 0; i < chang; i++) {
    int k = s[i] - '0';
    box = box + k * k * k;
  }
  cout << box;
  return 0;
}